package com.dy.seleniumlearn;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

public class WebElementOp2 {
    WebDriver driver;
    WebDriver.Navigation navigation;

    @BeforeMethod
    public void SetUp() {
        System.setProperty("webdriver.gecko.driver", "C:\\Program Files\\Mozilla Firefox\\geckodriver.exe");
        driver = new FirefoxDriver();
        navigation = driver.navigate();
    }

    @Test
    public void test() {
        driver.get("http://39.101.198.110/testhtml/exam/login.html");
        WebElement username = driver.findElement(By.cssSelector("[name='username']"));
        username.sendKeys("123");
        //username.submit();
        WebElement passwd = driver.findElement(By.cssSelector("[name='passWd']"));
        passwd.sendKeys("123");
        //passwd.submit();
        WebElement sbmit = driver.findElement(By.cssSelector("[type='submit']"));
        sbmit.submit();


    }

    @AfterMethod
    public void afterMethod() {
        //driver.close();
    }
}
